fcfbd7
@@ -169,9 +169,10 @@
public abstract class QueryUtils {
 		CONSTRUCTOR_EXPRESSION = compile(builder.toString(), CASE_INSENSITIVE + DOTALL);
 
 		builder = new StringBuilder();
-		builder.append("\\s+"); // at least one space
-		builder.append("\\w+\\([0-9a-zA-z\\._,\\s']+\\)"); // any function call including parameters within the brackets
-		builder.append("\\s+[as|AS]+\\s+(([\\w\\.]+))"); // the potential alias
+		// any function call including parameters within the brackets
+		builder.append("\\w+\\s*\\([\\w\\.,\\s'=]+\\)");
+		// the potential alias
+		builder.append("\\s+[as|AS]+\\s+(([\\w\\.]+))");
 
 		FUNCTION_PATTERN = compile(builder.toString());
 	}
@@ -325,7 +326,7 @@
public abstract class QueryUtils {
 	 * @param query a {@literal String} containing a query. Must not be {@literal null}.
 	 * @return a {@literal Set} containing all found aliases. Guaranteed to be not {@literal null}.
 	 */
-	private static Set<String> getFunctionAliases(String query) {
+	static Set<String> getFunctionAliases(String query) {
 
 		Set<String> result = new HashSet<>();
 		Matcher matcher = FUNCTION_PATTERN.matcher(query);
@@ -588,7 +589,8 @@
public abstract class QueryUtils {
 			propertyPathModel = from.get(segment).getModel();
 		}
 
-		if (requiresJoin(propertyPathModel, model instanceof PluralAttribute, !property.hasNext()) && !isAlreadyFetched(from, segment)) {
+		if (requiresJoin(propertyPathModel, model instanceof PluralAttribute, !property.hasNext())
+				&& !isAlreadyFetched(from, segment)) {
 			Join<?, ?> join = getOrCreateJoin(from, segment);
 			return (Expression<T>) (property.hasNext() ? toExpressionRecursively(join, property.next()) : join);
 		} else {
